Unable to save module

Using DOORS 8.3, I am trying to run through about 60 modules and delete the links then re-create them but after deleting the links I am unable to save the module. After the code below is run the links are deleted but the changes are not saved, when I change edit mode I am asked if I want to save the module, if I don't then the links are not deleted. All variable are declared globally as they are used by other functions. If the close is also used (currently commented out) then the module is closed without any changes being saved. I think I am missing something obvious but am at a loss to spot it at the moment, can anyone help?

void DeleteLinks ()
{
mTRS = edit(TRSName,true)
if (null mTRS) then
{
ack "No currently loaded module"
halt
}

current = mTRS

load (mTRS, view "Default") // if present
filtering (off)
count = 0

for oTRS in mTRS do
{
// Delete Links
for lnk in oTRS -> "*" do
{
count++
Object tgt = target(lnk)
delete(lnk)
}
}

save(mTRS)
file << "Save Module\n"
// close(mTRS, true)
file << "Links Deleted = " count " For : " TRS "\n"
}
SystemAdmin - Wed Aug 18 07:53:04 EDT 2010

Re: Unable to save module
Mathias Mamsch - Wed Aug 18 08:04:40 EDT 2010

Hmm ... I would suggest

a) you explicitly declare all your variables ( just to be sure :-) )
b) you issue a "flushDeletions()" after deleting the links
c) you don't delete the links in a loop ... usually this goes wrong:

for L in obj->"*" do { delete L } // the delete alters the links, so the loop gets confused. ouch!

 


instead do this:

 

 

 

Skip sk = create(); 
for L in obj->"*" do put(sk, L, L)
for L in sk do delete L
delete sk; sk = null



Hope this helps, regards, mathias



 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Unable to save module
SystemAdmin - Wed Aug 18 08:37:31 EDT 2010

Mathias Mamsch - Wed Aug 18 08:04:40 EDT 2010

Hmm ... I would suggest

a) you explicitly declare all your variables ( just to be sure :-) )
b) you issue a "flushDeletions()" after deleting the links
c) you don't delete the links in a loop ... usually this goes wrong:

for L in obj->"*" do { delete L } // the delete alters the links, so the loop gets confused. ouch!

 


instead do this:

 

 

 

Skip sk = create(); 
for L in obj->"*" do put(sk, L, L)
for L in sk do delete L
delete sk; sk = null



Hope this helps, regards, mathias



 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Thanks for that, flushDeletions() was all that was needed and I've also changed to use the skip list. Should have read the manual.